window.onload = () => {
    const mydiv = document.getElementById('mydiv') as HTMLElement
    const colors = ['pink','lightblue','lightgreen','gold','plum']
    let i = 0
    setInterval(() => {
      mydiv.style.backgroundColor = colors[i++ % colors.length];
    }, 1000)
  }